import request from '@/utils/request'

export const getDepartmentsAPI = () => request({ // 获取 ---- 部门列表
  url: '/company/department',
  method: 'GET'
})

export const departmentAPI = (id) => request({ // 删除 ---- 部门详情
  url: `/company/department/${id}`,
  method: 'DElETE'
})

export const adddepartmentAPI = ({ code, introduce, manager, name, pid }) => request({ // 增加 ---- 部门
  url: '/company/department',
  method: 'POST',
  data: {
    code,
    introduce,
    manager,
    name,
    pid
  }
})

export const simpleAPI = () => request({ // 获取 ---- 部门负责人列表
  url: '/sys/user/simple',
  method: 'GET'
})

export const getdepartmentAPI = (id) => request({ // 获取-部门详情
  url: `/company/department/${id}`,
  method: 'GET'
})

export const alertdepartmentAPI = ({ id, pid, name, code, manager, introduce, createTime }) => request({ // 修改部门详情
  url: `/company/department/${id}`,
  method: 'PUT',
  data: {
    id,
    pid,
    name,
    code,
    manager,
    introduce,
    createTime
  }
})
